//  dataArr [{}, {}, {}...]

module.exports = function($table, dataArr, configArr){

  $table.find('tbody').html('');
  let trTemplate = `<tr>`;
  configArr.forEach(key=>{
    trTemplate += `<td>${key}</td>`;
  });

  trTemplate += `</tr>`;

  dataArr.forEach( dataObj=>{

    let newTr = trTemplate;

    configArr.forEach( key=>{

      newTr = newTr.replace( key, dataObj[key] );

    } );

    $table.find('tbody').append(newTr);
  } );

};
